<%@ page import="com.jkt.rms.commons.includes.*"%>
<%@ page import="com.jkt.rms.constants.IConstants"%>
<%@ page import="java.util.*"%>
<%@ page import="com.jkt.rms.business.*"%>

<%@ include file="/WEB-INF/jsp/include.jsp" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="/spring"%>
<html>
<head>
<title><fmt:message key="lbl.title.createuser" /></title>
<SCRIPT language="javascript" type="text/javascript"> 
  function backtoSearch(k1,k2,k3,k4,mName){
	   	document.forms[0].action="adduser.htm?method="+mName+"&srchFirstName="+k1+"&srchLastName="+k2+"&srchUserName="+k3+"&srchRoleName="+k4;
	   	document.forms[0].method="post";
		document.forms[0].submit();
	}
</Script>
</head>
 <body><center>
 	<br>
	<div id="headerbar"><fmt:message key="lbl.title.createuser" /></div>
 	<div id="content">
	<div> 
		<c:if test="${ not empty errors.allErrors}">
		<div id="errorFieldSet" >
			<fieldset> 
 				<legend >Errors</legend> 				
 				  <c:forEach var="err" items="${errors.allErrors}">
					<spring:message code="${err.code}" arguments="${err.arguments[0]}" />
					<br />
				</c:forEach>
 			</fieldset>
		</div>
	</c:if> 
	
	<c:if test="${ not empty user.message}">
		<div id="infoFieldSet">
		<fieldset> 
		<legend >Messages</legend> 				
		<spring:message code="${user.message}"/>
		<br />
		</fieldset>
		</div>
	</c:if> 
  
	<table  width="90%" cellpadding="0" cellspacing="0" border = "0">
	<tr valign="top" align="center">
				<td width="80%">
			<div id = "UPDATEUSER">
				<form:form method="POST" commandName="user" action="updateuser.htm?method=addUser" name="addUserForm">
				  <fieldset>
				  <legend ><strong>Update User </strong></legend>
					<table width = "80%" border = "0" cellpadding="0" cellspacing="0" >
						
					  	<tr>
					  			<td align='right' width = "25%">User Name:</td> 
			            		<td align='left' width = "15%">
			            			<form:input   path="username"  tabindex="1"  readonly="true" maxlength="50" />
			           		 </td>
					  	
			            	<td align='right' class=header  width = "25%" >First Name:</td>
				            <td align='left' class=value width = "25%"> 
				           		<form:input   path="firstName" tabindex="2"  maxlength="50" />
			            	</td>
			            	
			            	
			            	  	
			         	 </tr>
			          <tr>
			          <td align='right' class=header width = "25%" >Last Name:</td>
				            <td width = "25%">
				            <form:input   path="lastName" tabindex="3" maxlength="50" />
		                    <input type = "hidden" value = '<c:out value="${user.srchFirstName}"/>' name = "srchFirstName1"/>
		       				<input type = "hidden" value = '<c:out value="${user.srchLastName}"/>' name = "srchLastName1"/>
					        <input type = "hidden" value = '<c:out value="${user.srchUserName}"/>' name = "srchUserName1"/>
					        <input type = "hidden" value = '<c:out value="${user.srchRoleName}"/>' name = "srchRoleName1"/>
					         <input type = "hidden" value = '<c:out value="${user.searchMethod}"/>' name = "searchMethod1"/>
			           </td>
			          
			            <td align='right'  width = "25%" >Role Name:</td>
			            	<td align='left'  width = "25%" >
			           		<form:select
								path="roleName" tabindex="4" cssStyle="width:160Px">
								<form:option value="0" label="Select" />
								<form:options items="${user.listRole}" itemValue="roleName" itemLabel="roleName"/>
						</form:select></td>	
						
			            
			             </tr>
			            
			            <tr>
				            <td align='right'  width = "25%">E-Mail:</td>
				            <td align='left'  width = "25%">
				           	 <form:input   path="email"  tabindex="5"  maxlength="100"/>		
				            </td>
				            <td align='right'  width = "25%" >Status:</td>
							<td >
							<form:select path="enabled" cssStyle="width:160Px" tabindex="6"  >
									<form:option value='' label="Select" />
									<form:option value='0'>InActive</form:option>
									<form:option value='1'>Active</form:option>
								</form:select>
							</td>
			          </tr>
			          <tr>
			            <td colspan=4 align=center>
			          		&nbsp;
			            </td>
			          </tr>
			          <tr >
			            <td colspan="4" align="center">
			              <input class="value" type='submit' name='button' value='Update'  title="" tabindex="7" onclick="dosubmit('user','adduser.htm?method=update')">
			             <input class="value" type='button' value='Back to Search Result'  tabindex="8" 
			             onclick="backtoSearch('<c:out value="${user.srchFirstName}"/>','<c:out value="${user.srchLastName}"/>',
			             '<c:out value="${user.srchUserName}"/>','<c:out value="${user.srchRoleName}"/>','<c:out value="${user.searchMethod}"/>');" >
			            </td>
			    
			          </tr>
			   
			     </table>
			     </fieldset>
			     </form:form>
			     </div>
      		</td>
		</tr>
	</table>	
		
		</div>
		<p>

		</p>
		<br>			
	</div>
<%@ include file="footer.jsp" %>
</center></body>
</html>
